//
//  TTSelectLabel.m
//  TeacherNet
//
//  Created by slz on 2017/11/27.
//  Copyright © 2017年 bnsr. All rights reserved.
//

#import "TTSelectLabel.h"

#define kTextColoraaaaa [UIColor colorWithRGB:0xaaaaaa]
#define kLineTextColor [UIColor colorWithRGB:0xcccccc]

@implementation TTSelectLabel

- (instancetype)initWithTitle:(NSString *)title
{
    self = [super init];
    if (self)
    {
        CGFloat labelWidth = (kScreenWidth - 60) * .5;
        self.size = CGSizeMake(labelWidth, 32);
        self.text = title;
        self.fontSize = 15;
        self.textAlignment = NSTextAlignmentCenter;
        self.textColor = kTextColoraaaaa;
        self.layer.borderWidth = 1;
        self.userInteractionEnabled =YES;
        self.layer.borderColor = kLineTextColor.CGColor;
        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTap)];
        [self addGestureRecognizer:tap];
    }
    return self;
}



- (void)labelTap
{
    self.state = !self.state;
}

-(void)setState:(BOOL)state
{
    if (state){
        self.textColor = kLoginGreenColor;
        self.layer.borderColor = kLoginGreenColor.CGColor;
    }else
    {
        self.textColor = kTextColoraaaaa;
        self.layer.borderColor = kLineTextColor.CGColor;
    }
    _state = state;
}

@end
